
package com.jf.cloud.payment.constant;

import java.util.Objects;

/**
 * 退款状态
 * @author zz
 */
public enum RefundStatus {

    /**
     * 未退款
     */
    UNREFUND(0, "未退款"),

    /**
     * 已退款
     */
    REFUNDED(1, "已退款")
    ;

    private final Integer num;
    private final String name;

    public Integer value() {
        return num;
    }

    RefundStatus(Integer num, String name) {
        this.num = num;
        this.name = name;
    }

    public static RefundStatus instance(Integer value) {
        RefundStatus[] enums = values();
        for (RefundStatus statusEnum : enums) {
            if (statusEnum.value().equals(value)) {
                return statusEnum;
            }
        }
        return null;
    }

    public static String getName(Integer value) {
        RefundStatus refundStatus = instance(value);
        if (Objects.isNull(refundStatus)) {
            return null;
        }
        return refundStatus.name;
    }
}
